/**
 * Created by Administrator on 2017/10/9.
 * 浏览器版本检测
 */

function checkBrowser() {
    var userAgent = navigator.userAgent;
    /*var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
    var isEdge = userAgent.indexOf("Edge") > -1 && !isIE;
    var isIE11 = userAgent.indexOf("Trident") > -1 && userAgent.indexOf("rv:11.0")> -1;
    if(isIE){
        var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
        reIE.test(userAgent);
        var ieVersion = parseFloat(RegExp["$1"]);
        if(ieVersion > 7){
            return true;
        }else {
            return false;
        }
    }else if(isEdge){
        return true;
    }else if(isIE11){
        return true;
    }else {
        return true;
    }*/

    //return false;
    if(userAgent.indexOf("MSIE")!=-1 || userAgent.indexOf('Trident/7.0') !== -1) {
        return false;
    }
    return true;
}

// ie 9.0以下或者360浏览器为ie模式 提示用户
if(!checkBrowser()) {
    var browser_html = "";
        browser_html += "<div class=\"browser-tip\">";
        browser_html += "<div class=\"dialog_bg\"></div>";
        browser_html += "<div class=\"browser-tip-content\">";
        browser_html += "<div class=\"area\">";
        browser_html += "<div class=\"pull-left info\">";
        browser_html += "<div>抱歉, 系统检测到您的浏览器版本过低，可能导致网站不能正常访问。</div>";
        browser_html += "<div>如果您使用的是<span style=\"color:red;\">360浏览器</span>,推荐升级切换至【极速模式】。切换方式如图所示。</div>";
        browser_html += "</div>";
        browser_html += "<div class=\"pull-left\">";
        browser_html += "<a href=\"http://chrome.360.cn\" target=\"_blank\">下载360浏览器</a>";
        browser_html += "</div>";
        browser_html += "</div>";
        browser_html += "<img src=\""+resourcePath+"/static/global/images/tem.png\">";
        browser_html += "</div>";;
        browser_html += "</div>";

    var browser_style = "<style type=\"text/css\">";
        browser_style += "body.ie{overflow: hidden;height:100%;font-family: '微软雅黑';}";
        browser_style += "body.ie .browser-tip{display: block;position: absolute;left:0;bottom:0;right:0;top:0;}";
        browser_style += ".browser-tip{display: none;}";
        browser_style += "body.ie .dialog_bg{position: absolute;left:0;right:0;top:0;bottom:0;z-index:10000;filter:alpha(opacity=40);opacity:0.4;background: #000;}";
        browser_style += "body.ie .browser-tip-content{left:0;right:0;position: absolute;bottom:0;z-index:10001;padding: 20px 0px 0px 0px;background-color: #F0E68C;}";
        browser_style += "body.ie .browser-tip-content .info{font-size:15px;color:#333;width:800px;line-height: 26px;padding-left:88px;font-weight: bold;padding-bottom:10px;}";
        browser_style += "body.ie .browser-tip-content a{display: inline-block;padding:10px 16px;font-size:16px;background: #48a2ff;color:#fff;border-radius: 3px;    margin-top: 3px;margin-left: 45px;}";
        browser_style += "body.ie .browser-tip-content img{position: relative;width:100%;height:auto;}";
        browser_style += "body.ie .browser-tip-content .last{display: none;position: absolute;top:-190px;}";
        browser_style += "</style>";
    $('body').append(browser_html);
    $('body').append(browser_style);
    $('body').addClass('ie');
}

